#!/usr/bin/python
#Filename: back_ver2.py

import os
import time

source = ['/nothing/python', '/root/AD']
target_dir = '/tmp/'

today = target_dir + time.strftime('%Y%m%d')
now = time.strftime('%H%M%S')

if not os.path.exists(today):
    os.mkdir(today)
    print 'Successfully create directory ', today

target = today + os.sep + now + '.zip'

print "%s" % target
print "%s" % ' '.join(source)

zip_command = "zip -qr %s %s" % (target, ' '.join(source))
print "%s" % zip_command

if os.system(zip_command) == 0:
    print 'Successfully backup to ', target
else:
    print 'Backup failed'

